import React from 'react';
import { View } from 'react-native';
import { Lt, Color, Nav, Label, Jpp, Jx, Dialog } from "../_utils";
import { Net, NET_RI } from "../_net"
import { ViewReport, LabelHead, cMe } from './_me';

const c_fields = ["预估收益","已结算","订单数量"];
// 我的收益报表
export class Profit extends React.PureComponent{
    constructor(props){
        super(props);
        
        const {data} = this.props.navigation.state.params;
        const data2 = {
            inCome:Jpp.questionMark, //预估总收益	
            oderSum:Jpp.questionMark, //订单总数量	

            today:Jpp.questionMark, //今日预估收益	
            yesday:Jpp.questionMark, //昨日预估收益
            yesMonday:Jpp.questionMark, //本月预估收益	
            lastMonday:Jpp.questionMark, //上月预估收益
                       
            todaySettle:Jpp.questionMark, //今日结算
            yesdaySettle:Jpp.questionMark, //昨日结算	
            yesMondaySettle:Jpp.questionMark, //本月结算	
            lastMondaySettle:Jpp.questionMark, //上月结算	

            todayOder:Jpp.questionMark, //今日订单数	
            yesdayOder:Jpp.questionMark, //昨日订单数	
            yesMondayOder:Jpp.questionMark, //本月订单数	
            lastMondayOder:Jpp.questionMark, //上月订单数         	
        }
        this.state = {
            preData : data,
            data : data2,
        }
    }
    static navigationOptions = {
        ...Nav.options,
        headerTitle: "收益报表",
    }
    componentWillMount(){
        Net.request("oder/InCome", null, {NET_RI}).then(r=>{
            if(r.data){
                this.setState({data: cMe.toIncome(r.data)});
            }
        });
    }
    render(){
        const {data} = this.state;
        return <View style = {{flex:1, backgroundColor:Color.back}}>
            <Nav.StatusBar/>
            <View style={{backgroundColor:Color.theme, paddingVertical:20, flexDirection:"row", alignItems:"center", margin:Lt.margin, borderRadius:Lt.radius}}>
                <LabelHead title={"预估总收益"}>{data.inCome}</LabelHead>
                <View style={{width:1, height:40, backgroundColor:Color.whiteOpacity}}/>
                <LabelHead title={"订单总数量"}>{data.oderSum}</LabelHead>
            </View>
{/* inCome:Jpp.questionMark, //预估总收益	
oderSum:Jpp.questionMark, //订单总数量	

today:Jpp.questionMark, //今日预估收益	
yesday:Jpp.questionMark, //昨日预估收益
yesMonday:Jpp.questionMark, //本月预估收益	
lastMonday:Jpp.questionMark, //上月预估收益
           
todaySettle:Jpp.questionMark, //今日结算
yesdaySettle:Jpp.questionMark, //昨日结算	
yesMondaySettle:Jpp.questionMark, //本月结算	
lastMondaySettle:Jpp.questionMark, //上月结算	 

todayOder:Jpp.questionMark, //今日订单数	
yesdayOder:Jpp.questionMark, //昨日订单数	
yesMondayOder:Jpp.questionMark, //本月订单数	
lastMondayOder:Jpp.questionMark, //上月订单数
*/}
            <ViewReport date={"今日"} fields={c_fields} values={[data.today, data.todaySettle, data.todayOder,]}/>
            <ViewReport date={"昨日"} fields={c_fields} values={[data.yesday, data.yesdaySettle, data.yesdayOder,]}/>
            <ViewReport date={"当月"} fields={c_fields} values={[data.yesMonday, data.yesMondaySettle, data.yesMondayOder,]}/>
            <ViewReport date={"上月"} fields={c_fields} values={[data.lastMonday, data.lastMondaySettle, data.lastMondayOder,]}/>
        </View>;
    }
}